package com.hlbspringcloud.contentcenter;

import com.hlbspringcloud.contentcenter.configuration.GlobalUserCenterFeignConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.alibaba.sentinel.annotation.SentinelRestTemplate;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @Description: 内容中心
 * @PROJECT_NAME: spring-cloud-alibaba
 * @CLASS_NAME:
 * @Author: huanglibin
 * @Date: 2020-05-24 1:28
 * @Version: 1.0
 */
@SpringBootApplication
//扫描Mapper下的xml文件
@MapperScan("com.hlbspringcloud")
@EnableFeignClients(defaultConfiguration = GlobalUserCenterFeignConfiguration.class)
public class ContentCenterApplication {
    public static void main(String[] args) {
        SpringApplication.run(ContentCenterApplication.class,args);
    }

    /**在spring容器中,创建一个对象,类型RestTemplate,名称/ID */
    @Bean
    @LoadBalanced
    @SentinelRestTemplate
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
